import flet as ft
from modules.ui import create_ui
from modules.config import get_config
from modules.utils import setup_logging

# 设置日志
logger = setup_logging()

# 获取配置
config = get_config()
def main(page: ft.Page):
    logger.info("AI绘图应用启动")
    
    # 设置页面基础属性 - 创建无边框窗口
    page.title = "SiliconFlow 图像生成器"
    page.window_width = config["window_width"]
    page.window_height = config["window_height"]
    page.window_resizable = True
    page.theme_mode = config["theme_mode"]
    
    # 创建UI
    ui_content = create_ui(page, config, logger)
    
    # 添加到页面
    page.add(ui_content)
    
    logger.info("应用初始化完成")

if __name__ == "__main__":
    logger.info("启动Flet应用...")
    ft.app(target=main)